//从redux包中导入legacy_createStore和applyMiddleware
import {legacy_createStore as createStore,applyMiddleware} from 'redux'
//导入shopcartReducer
import {shopcartReducer} from './reducers/shopcartReducer'
//导入sagas文件
import sagas from './sagas'
//导入createSagaMiddleware函数
import createSagaMiddleware from 'redux-saga'
//通过createSagaMiddleware函数创建sagaMiddleware中间件对象
const sagaMiddleware=createSagaMiddleware()
//通过createStore函数创建store对象，这个函数有两个参数
//第1个参数是reducer对象
//第2个参数是中间件对象
const store=createStore(shopcartReducer,applyMiddleware(sagaMiddleware))
//运行saga的入口文件
sagaMiddleware.run(sagas)
//将store导出
export default store
